home *** CD-ROM | disk | FTP | other *** search
- property ancestor, pFunction, pFirstMemberNum, pSpriteNum, pClickedFlag, pActiveOnDownFlag, pRepeatWhileDownFlag, pRepeatDelayTicks, pForceRollFlag
-
- on new me, myPropList
- set pSpriteNum to getaProp(myPropList, #sprite)
- set pFirstMemberNum to getaProp(myPropList, #firstMember)
- set pFunction to getaProp(myPropList, #command)
- set pClickedFlag to 0
- set pDownFlag to 0
- set pRepeatWhileDownFlag to getaProp(myPropList, #repeat)
- set pActiveOnDownFlag to getaProp(myPropList, #down)
- set pRepeatDelayTicks to getaProp(myPropList, #delay)
- set pForceRollFlag to getaProp(myPropList, #forceRoll)
- set ancestor to new(script "ButtonAncestor", me)
- set the memberNum of sprite pSpriteNum to pFirstMemberNum
- add(the actorList, me)
- return me
- end
-
- on mButtonDown me, myCommandArgs
- if not voidp(myCommandArgs) then
- set tOldFunction to pFunction
- if the last char in pFunction = ")" then
- if char the number of chars in pFunction - 1 of pFunction = "(" then
- delete char -30000 of pFunction
- else
- delete char -30000 of pFunction
- put "," after pFunction
- end if
- else
- put "(" after pFunction
- end if
- put myCommandArgs after pFunction
- put ")" after pFunction
- end if
- set tClickTicks to the ticks
- set the memberNum of sprite pSpriteNum to pFirstMemberNum + 2
- set pClickedFlag to 1
- if pActiveOnDownFlag = 1 then
- do(pFunction)
- end if
- updateStage()
- repeat while the mouseDown
- if rollOver(pSpriteNum) or (pForceRollFlag = 1) then
- set the memberNum of sprite pSpriteNum to pFirstMemberNum + 2
- set pClickedFlag to 1
- repeat while (the ticks < (tClickTicks + pRepeatDelayTicks)) and the stillDown
- nothing()
- end repeat
- if (pRepeatWhileDownFlag = 1) and the stillDown then
- do(pFunction)
- end if
- else
- set the memberNum of sprite pSpriteNum to pFirstMemberNum
- set pClickedFlag to 0
- end if
- updateStage()
- end repeat
- if not voidp(tOldFunction) then
- set pFunction to tOldFunction
- end if
- end
-
- on mButtonUp me
- if not pClickedFlag then
- exit
- end if
- if rollOver(pSpriteNum) then
- if pActiveOnDownFlag = 1 then
- nothing()
- else
- do(pFunction)
- end if
- end if
- mResetButton(me)
- set pClickedFlag to 0
- end
-